<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>v-on</title>
  <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
  <h1>v-on</h1>
  <hr>
  <div id="app">
    score:
    <span v-text="score"></span>
    <p>
      <button v-on:click="addScore">add score</button>
      <button @click="subtractScore">subtract score</button><br>
      <input type="text" v-on:keyup.enter="onEnter" v-model="score2">
    </p>
  </div>
  <script type="text/javascript">
  var app = new Vue({
    el:'#app',
    data:{
      score:0,
      score2:0
    },
    methods:{
      addScore:function(){
        this.score++;
      },
      subtractScore:function(){
        this.score--;
      },
      onEnter:function(){
        this.score += parseInt(this.score2);
      }
    }
  })
  </script>
</body>
</html>